package thread;

/**
 * 第二种创建线程方式：实现Runner 接口
 */
public class ThreadDemo2 {
    public static void main(String[] args) {
        //单独实例化任务
        MyThread1 M1 = new MyThread1();
        MyThread2 M2 = new MyThread2();
        //创建线程
        Thread T1 = new Thread(M1);
        Thread T2 = new Thread(M2);
        T1.start();
        T2.start();

    }
}
class MyRunnable11 implements Runnable{
    @Override
    public void run() {
        for (int i=0;i<1000;i++){
            System.out.println("你好啊");
        }
    }
}
class MyRunnable12 implements Runnable{
    @Override
    public void run() {
        for (int i=0;i<1000;i++){
            System.out.println("我是你123");
        }
    }
}
